<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<script type="text/javascript">
	$('#userAddOzTree').combotree({
		url : '${ctx}/oz/tree.do',
		parentField : 'pid',
		lines : true,
		panelHeight : 'auto',
		value : '${oz.pid}',
		onLoadSuccess : function() {
			$.messager.progress('close');
		}
	});

	$(function() {
		parent.$.messager.progress('close');
		$('#useradd_Form').form({
			url : '${ctx}/user/save.do',
			onSubmit : function() {
				parent.$.messager.progress({
					title : '提示',
					text : '数据处理中，请稍后....'
				});
				var isValid = $(this).form('validate');
				if (!isValid) {
					parent.$.messager.progress('close');
				}
				return isValid;
			},
			success : function(result) {
				parent.$.messager.progress('close');
				result = $.parseJSON(result);
				if (result.success) {
					parent.$.modalDialog.openner_dataGrid.datagrid('reload');//之所以能在这里调用到parent.$.modalDialog.openner_dataGrid这个对象，是因为user.jsp页面预定义好了
					parent.$.modalDialog.handler.dialog('close');
				} else {
					parent.$.messager.alert('错误', result.msg, 'error');
				}
			}
		});
	});
	
	
	$(function() {
		$(":button").click(function() {
			if ($("#file1").val().length > 0) {
				ajaxFileUpload();
			} else {
				alert("请选择图片");
			}
		});
	});
</script>
<div class="easyui-layout" data-options="fit:true,border:false">
	<div data-options="region:'center',border:false" title="" style="overflow: hidden;">
		<form id="useradd1_Form" method="post">
			<table class="table table-hover table-condensed">
				<tr>
					<th>登录名称</th>
					<td><input name="username" type="text" placeholder="请输入登录名称" class="easyui-validatebox span2"  value=""></td>
					<th>姓名1</th>
					<td><input name="name"     type="text" class="span2" value="${user.name}"></td>
				</tr>
				<tr>
					<th>性别</th>
					<td>
						<select name="sex" class="easyui-combobox" data-options="width:180,height:29,editable:false,panelHeight:'auto'">
								<option value="男">男</option>
								<option value="女">女</option>
						</select>
					</td>
					<th>所属部门</th>
					<td><input name="oid"    id="userAddOzTree" type="text" class="easyui-validatebox span2"></td>
				</tr>
				<tr>
					<th>座机</th>
					<td><input name="tel"     type="text" placeholder="请输入座机电话号码"  class="easyui-validatebox span2"></td>
					<th>手机</th>
					<td><input name="mobile"  type="text" placeholder="请输入手机机电话号码" class="easyui-validatebox span2"></td>
				</tr>
				<tr>
					<th>办公地点</th>
					<td><input name="officeloc"     type="text"  class="easyui-validatebox span2"></td>
					<th>职务</th>
					<td><input name="post"  type="text" class="easyui-validatebox span2" ></td>
				</tr>
				<tr>
				<th>缩略图：</th>
				<td>
				<input type="file" id="file1" name="file" /><input type="button" value="重新上传" /></br>
				<input type="hidden" name="attpath" id="path">
				</td>
				<th></th>
				<td>
					<img id="img1" name="attpath" src="${attpath}">
				</td>
			</tr>
			</table>
		</form>
	</div>
</div>